package com.company.day2;
//(显示闰年)显示从101到2100期问所有的闰年，每行显示10个。数字之间用一个空格字符隔开，同时显示这期问闰年的数目。
public class LeapYear {
    public static void main(String[] args) {
        int num = 0; //计数闰年
        System.out.println("The leap years from 101 to 2100 are: ");
        for(int i = 101; i <= 2100; i++){
            if( (i % 4 == 0 && i % 100 != 0) || i % 400 == 0 ){
                num++;
                System.out.printf(i + " ");
                if(num % 10 == 0){
                    System.out.println("");
                }
            }
        }
        System.out.println("");
        System.out.printf("The number of the leap year is " + num);
    }
}
